package com.yunfeisoft.business.service.impl;

import com.applet.base.BaseServiceImpl;
import com.applet.sql.separation.DataSourceChange;
import com.applet.utils.Page;
import com.yunfeisoft.business.dao.inter.SmsFlashPromotionSessionDao;
import com.yunfeisoft.business.model.SmsFlashPromotionSession;
import com.yunfeisoft.business.service.inter.SmsFlashPromotionSessionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * ClassName: SmsFlashPromotionSessionServiceImpl
 * Description: 限时购场次表service实现
 * Author: Jackie liu
 * Date: 2020-06-02
 */
@Service("smsFlashPromotionSessionService")
public class SmsFlashPromotionSessionServiceImpl extends BaseServiceImpl<SmsFlashPromotionSession, String, SmsFlashPromotionSessionDao> implements SmsFlashPromotionSessionService {

    @Override
    @DataSourceChange(slave = true)
    public Page<SmsFlashPromotionSession> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public List<SmsFlashPromotionSession> queryList(Map<String, Object> params) {
        return getDao().queryList(params);
    }

    @Override
    public int modifyStatus(String id, int status) {
        if (StringUtils.isBlank(id)) {
            return 0;
        }

        SmsFlashPromotionSession promotionSession = new SmsFlashPromotionSession();
        promotionSession.setId(id);
        promotionSession.setStatus(status);
        return getDao().update(promotionSession);
    }
}